// user.js
import request from "@/utils/request";

//通过用户名和密码获取用户信息
export function checkLoginNameAndPassword(data) {
  return request({
    url: "/employeeLogin/login",
    method: "post",
    data: {
      loginName: data.username,
      password: data.password
    }
  });
}

// 获取员工列表（分页）
export function getEmployeeList(params) {
  return request({
    url: '/employees/page',
    method: 'get',
    params
  })
}

// 获取员工详情
export function getEmployeeDetail(id) {
  return request({
    url: `/employees/${id}`,
    method: 'get'
  })
}

// 删除员工
export function deleteEmployee(employeeId) {
  return request({
    url: `/employees/${employeeId}`,
    method: 'delete'
  })
}

// 更新员工信息
export function updateEmployee(data) {
  return request({
    url: '/employees',
    method: 'put',
    data
  })
}

// 新增员工
export function addEmployee(data) {
  return request({
    url: '/employees',
    method: 'post',
    data
  })
}